/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 *
 */

import { HvigorLogger } from '../log/hvigor-log.js';
import { ModuleOpt } from '../common/options/project-structure-opt.js';

/**
 * 工程初始化时校验build-profile.json5
 */
export class ValidateUtil {
  private static logger: HvigorLogger = HvigorLogger.getLogger(ValidateUtil.name);

  public static validateModule(module: ModuleOpt): void {
    if (module.name === undefined || module.name === '') {
      this.logger.printErrorExit('THE_REQUIRE_ATTRIBUTE_MODULE_NAME_IS_MISSING');
    }
    if (module.srcPath === undefined || module.srcPath === '') {
      this.logger.printErrorExit('THE_REQUIRE_ATTRIBUTE_MODULE_SRCPATH_IS_MISSING');
    }
  }
}
